<?php
/**
 * 测试订单API接口
 */

// 模拟请求参数
$params = [
    'current' => 1,
    'pageSize' => 10,
    'status' => '',
    'pay_status' => '',
    'express_type' => '',
    'keyword' => ''
];

// 构建查询字符串
$queryString = http_build_query($params);

// 测试URL
$url = "http://localhost:8787/admin/order/index?{$queryString}";

echo "测试订单列表API:\n";
echo "URL: {$url}\n\n";

// 使用cURL测试
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

echo "HTTP状态码: {$httpCode}\n";
echo "响应内容:\n";
echo $response . "\n";

if (curl_error($ch)) {
    echo "cURL错误: " . curl_error($ch) . "\n";
}

curl_close($ch);

// 测试订单详情API
echo "\n\n测试订单详情API:\n";
$detailUrl = "http://localhost:8787/admin/order/detail?id=1";
echo "URL: {$detailUrl}\n\n";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $detailUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

echo "HTTP状态码: {$httpCode}\n";
echo "响应内容:\n";
echo $response . "\n";

if (curl_error($ch)) {
    echo "cURL错误: " . curl_error($ch) . "\n";
}

curl_close($ch);
?>
